package com.sys.service.impl;

import com.bhudy.base.BaseServiceImpl;
import com.bhudy.base.QueryFilter;
import com.sys.entity.SysUserRole;
import com.sys.service.SysUserRoleService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.List;

/**
 * @Author com.bhudy
 * @Description 用户关联角色Service实现类
 * @Date 2019-10-30 23:09:37
 */
@Service
@Transactional
public class SysUserRoleServiceImpl extends BaseServiceImpl<SysUserRole, Serializable> implements SysUserRoleService {

    @Override
    public int createSysUserRoles(List<SysUserRole> sysUserRoleList, Long userId) {
        QueryFilter queryFilter = new QueryFilter();
        queryFilter.and("userId", userId);
        super.delete(queryFilter);

        return super.insert(sysUserRoleList);
    }
}
